﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace GUESTSMANAGEMENT.Controller
{
    public class Report
    {
           public static void getList()
        {
            //seta a variável lista            

            using (guestsmanagementEntities context = new guestsmanagementEntities())
            {
                var selectListGuests = from guestlists in context.gmlistguests.Include("gmuser.nmuser")
                                       from gevent in context.gmevent.Include("gmevent.nmevent")
                                       from user in context.gmuser.Include("gmuser.nmuser")
                                       from guests in context.gmguests.Include("gmguests.nmguests")
                                       where guestlists.GMUSER_CDUSER == user.CDUSER && gevent.CDEVENT == guestlists.GMEVENT_CDEVENT
                                       
                                       group guestlists by new { guestlists.GMUSER_CDUSER, guestlists.GMEVENT_CDEVENT } into g 
                                       select new { g.Key.GMUSER_CDUSER, g.Key.GMEVENT_CDEVENT }; 
                
                var lista = selectListGuests.ToList();
            }
        }
    }
}
